VERSION 5.00
Object = "{76DA8CE9-E736-47FC-B43F-82650E2EFBAF}#1.0#0"; "oControls.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmSec_Company 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   0  'None
   Caption         =   "Company Info"
   ClientHeight    =   3225
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   6585
   FillColor       =   &H00FDEAE1&
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   3225
   ScaleWidth      =   6585
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Tag             =   "Settings"
   Begin oControls.oTab tabMain 
      Height          =   2730
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   6240
      _ExtentX        =   11007
      _ExtentY        =   4815
      TabCount        =   2
      TabCaption(0)   =   "            MAIN            "
      TabContCtrlCnt(0)=   1
      Tab(0)ContCtrlCap(1)=   "frmContainer"
      TabCaption(1)   =   "            LIST            "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "oFrames2"
      TabStyle        =   1
      TabTheme        =   1
      ActiveTabBackStartColor=   16514555
      ActiveTabBackEndColor=   16514555
      InActiveTabBackStartColor=   16777215
      InActiveTabBackEndColor=   15397104
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   10198161
      DisabledTabBackColor=   -2147483633
      DisabledTabForeColor=   10526880
      XRadius         =   15
      YRadius         =   15
      Begin oControls.oFrames oFrames2 
         Height          =   2430
         Left            =   -75000
         Tag             =   "."
         Top             =   300
         Width           =   6225
         _ExtentX        =   10980
         _ExtentY        =   4286
         FrameColor      =   16777215
         FillColor       =   16640737
         RoundedCorner   =   0   'False
         Caption         =   "List of Quotations"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Picture         =   "frmSec_Company.frx":0000
         Begin MSDataGridLib.DataGrid dtgList 
            Height          =   2010
            Left            =   0
            TabIndex        =   3
            Tag             =   "."
            Top             =   420
            Width           =   6225
            _ExtentX        =   10980
            _ExtentY        =   3545
            _Version        =   393216
            AllowUpdate     =   0   'False
            BackColor       =   16777215
            HeadLines       =   1
            RowHeight       =   15
            FormatLocked    =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   2
            BeginProperty Column00 
               DataField       =   "cCompID"
               Caption         =   "Company ID"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "cName"
               Caption         =   "Company Name"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
               EndProperty
               BeginProperty Column01 
                  ColumnWidth     =   4199.811
               EndProperty
            EndProperty
         End
      End
      Begin oControls.oFrames frmContainer 
         Height          =   2430
         Left            =   0
         Top             =   300
         Width           =   6240
         _ExtentX        =   11007
         _ExtentY        =   4286
         FrameColor      =   16640737
         BackColor       =   16640737
         FillColor       =   16777215
         RoundedCorner   =   0   'False
         Caption         =   "Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Picture         =   "frmSec_Company.frx":0A12
         Begin oControls.oTextBox txtcCompID 
            Height          =   285
            Left            =   120
            TabIndex        =   1
            Tag             =   "1"
            Top             =   570
            Width           =   3090
            _ExtentX        =   5239
            _ExtentY        =   503
            BackColor       =   14745599
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Company ID"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   1530
         End
         Begin oControls.oTextBox txtcName 
            Height          =   285
            Left            =   120
            TabIndex        =   2
            Top             =   885
            Width           =   5265
            _ExtentX        =   9075
            _ExtentY        =   503
            BackColor       =   14745599
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Company Name"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   3705
         End
         Begin oControls.oTextBox txtcAddress 
            Height          =   285
            Left            =   120
            TabIndex        =   4
            Top             =   1200
            Width           =   5265
            _ExtentX        =   9075
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Address"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   3705
         End
         Begin oControls.oTextBox txtcContact 
            Height          =   285
            Left            =   120
            TabIndex        =   5
            Top             =   1515
            Width           =   5265
            _ExtentX        =   9075
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Contact No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   3705
         End
         Begin oControls.oTextBox txtcTin 
            Height          =   285
            Left            =   120
            TabIndex        =   6
            Top             =   1830
            Width           =   5265
            _ExtentX        =   9075
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "TIN"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   3705
         End
      End
   End
End
Attribute VB_Name = "frmSec_Company"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'----------------------------------------------------------------------------------------------------------------------------------
'Standard Programming Format----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------------------------------------------------

Dim cnHeader As New Connection
Dim rsHeader As New Recordset
Dim tmpObj As Object

Dim sBit() As Boolean
Dim vBookmark As Variant

Public mode As eMode

Private Sub DataOtherBind()
    Set dtgList.DataSource = rsHeader
End Sub

Public Sub TBNew()
    mode = AddEditNew
    
    If rsHeader.State <> 1 Then
        TranConnect cnHeader
        TranRecordset Mid$(Me.Name, 4, Len(Me.Name)), rsHeader, cnHeader, "1=0"
        
        DataSourceBind rsHeader, Me
        DataFieldBind rsHeader, Me
        DataOtherBind
    Else
        vBookmark = rsHeader.Bookmark
    End If
    
    ControlObjects Me
    BitEnable sBit, Me, oMDI
    
    rsHeader.AddNew
    
    
    RSDisconnectCN rsHeader
    
End Sub

Public Sub TBEdit()
    mode = AddEditNew
    
    ControlObjects Me
    
    RSDisconnectCN rsHeader
    
    BitEnable sBit, Me, oMDI
End Sub

Public Sub TBDelete()
    On Error GoTo ErrHandler
    
    Dim sID As String
    
    RSConnectCN rsHeader, cnHeader
    
    sID = rsHeader!cTranNo
    
    If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, ProjectVersion) = vbNo Then Exit Sub
    
    AuditLog Mid$(Me.Name, 4, Len(Me.Name)), Trim(txtcCompID), "Deleted"
    rsHeader.Delete adAffectCurrent
    
    rsHeader.UpdateBatch adAffectAll
    
    TBPrevious
    mode = Normal
    
    If rsHeader.RecordCount = 0 Then
        ClearDataValue Me
    Else
        vBookmark = rsHeader.Bookmark
        DataUnbind Me
        DataSourceBind rsHeader, Me
        DataFieldBind rsHeader, Me
        rsHeader.Bookmark = vBookmark
    End If
    
    BitEnable sBit, Me, oMDI

ErrHandler:
    If Err.Number = -2147217885 Then
        Resume Next
    ElseIf Err.Number = -2147217864 Or Err.Number = -2147217887 Then
        cn.Execute "DELETE " & Mid$(Me.Name, 4, Len(Me.Name)) & "_D WHERE cTranNo = '" & sID & "' AND cCompID = '" & sCompanyID & "'"
        cn.Execute "DELETE " & Mid$(Me.Name, 4, Len(Me.Name)) & " WHERE cTranNo = '" & sID & "' AND cCompID = '" & sCompanyID & "'"
        Resume Next
    End If

End Sub

Public Sub TBSave()
    On Error GoTo ErrHandler
    Dim lNew As Boolean
    
    mode = Find
    If rsHeader.Status = adRecNew Then lNew = True
    If MandatoryOK(Me) = False Then Exit Sub
    
    RSConnectCN rsHeader, cnHeader

    cn.BeginTrans
    cnHeader.BeginTrans
    
    rsHeader.UpdateBatch adAffectAll
   
    cn.CommitTrans
    cnHeader.CommitTrans
    
    Set FrmName = Me
    mode = Normal
    ControlObjects Me
    
    AuditLog Mid$(Me.Name, 4, Len(Me.Name)), rsHeader!cCompID, IIf(lNew, "Add Record", "Modify Record")
    MsgBox "Record/s successfully saved.", vbInformation, ProjectVersion
    
    BitEnable sBit, Me, oMDI
ErrHandler:
    If Err.Number = -2147168237 Then
        rsHeader.CancelBatch adAffectCurrent
        cnHeader.RollbackTrans
    ElseIf Err.Number <> 0 Then
        MsgBox Err.Description, vbCritical, ProjectVersion
    End If
End Sub

Public Sub TBUndo()
    mode = Normal
    
    If rsHeader.Status = adRecNew Then
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
    End If
        
    DataUnbind Me
    If rsHeader.RecordCount = 0 Then
        ClearDataValue Me
        rsHeader.Close
        mode = Find
    Else
        rsHeader.Bookmark = vBookmark
        DataSourceBind rsHeader, Me
        DataFieldBind rsHeader, Me
        DataOtherBind
    End If
    
    ControlObjects Me
    BitEnable sBit, Me, oMDI
End Sub

Public Sub TBFind()
    Dim sCond As String
    
    If mode = Find Then
        mode = Normal
        
        sCond = GetSearchString(Me)
        TranConnect cnHeader
        TranRecordset Mid$(Me.Name, 4, Len(Me.Name)), rsHeader, cnHeader, sCond
        
        DataSourceBind rsHeader, Me
        DataFieldBind rsHeader, Me
        DataOtherBind
        
        RSDisconnectCN rsHeader
               
    Else
        mode = Find
        rsHeader.Close
        DataUnbind Me
        ClearDataValue Me
    End If
    
    ControlObjects Me
    BitEnable sBit, Me, oMDI
End Sub

Public Sub TBPrint()
    PrintReceipt Mid$(Me.Name, 4, Len(Me.Name)), rsHeader!cTranNo
End Sub

Public Sub TBFirst()
    FirstRecord rsHeader
End Sub

Public Sub TBPrevious()
    PreviousRecord rsHeader
End Sub

Public Sub TBNext()
    NextRecord rsHeader
End Sub

Public Sub TBLast()
    LastRecord rsHeader
End Sub

Public Sub TBNewLine()
    
End Sub

Public Sub TBDeleteLine()

End Sub

Public Sub TBApprove()

End Sub

Public Sub TBReject()

End Sub

Public Sub TBUntag()

End Sub

Public Sub TBClose()
    On Error Resume Next
    Set FrmName = Nothing
    Unload Me
End Sub

Public Sub TBReload()
    Me.ZOrder
    Set FrmName = Me
    BitEnable sBit, Me, oMDI
End Sub

Private Sub Form_Click()
    TBReload
End Sub

Private Sub Form_Load()
    GetAccessLevel oMDI.tbMain, sUserRole, Me.Name, sBit()
    mode = Find
        
    ApplyFrameTheme frmContainer, Me
    BitEnable sBit, Me, oMDI
End Sub
 
